//
//  UIImage+Utility.h
//  Utility
//
//  Created by Robin on 8/15/16.
//  Copyright © 2016 Robin. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Utility)
/**
 *  This method is very simple, and works great. However, this method is not thread safe
 *
 *  @param image   <#image description#>
 *  @param newSize <#newSize description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize;

/**
 *  The benefit of this method is that it is thread-safe, plus it takes care of all the small things (using correct color space and bitmap info, dealing with image orientation) that the UIKit version does.
 *
 *  @param sourceImage <#sourceImage description#>
 *  @param newSize     <#newSize description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage *)imageSafeThreadWithImage:(UIImage*)sourceImage scaledToSize:(CGSize)newSize;

/**
 *  The method we employ here is to create a bitmap with the desired size, but draw an image that is actually larger, thus maintaining the aspect ratio.
 *
 *  @param sourceImage <#sourceImage description#>
 *  @param targetSize  <#targetSize description#>
 *
 *  @return <#return value description#>
 */
+ (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSizeWithSameAspectRatio:(CGSize)targetSize;
@end
